package com.battle.service.controller.web;

import com.battle.pojo.param.questionBankDetailsStudy.*;
import com.battle.pojo.vo.questionBankDetailsStudy.*;
import com.battle.service.service.in.*;
import nirvana.core.domains.vo.PageResult;
import nirvana.core.domains.vo.ApiResult;
import org.springframework.web.bind.annotation.*;

import jakarta.validation.Valid;

import java.util.List;

/**
 * web/题目学习
 * 【描 述】：
 * 【环 境】：J2SE
 * 【详 细】：
 */
@RestController
@RequestMapping("/questionBankDetailsStudy/web")
public class QuestionBankDetailsStudyWebController {

    private final QuestionBankDetailsStudyService service;

    public QuestionBankDetailsStudyWebController(QuestionBankDetailsStudyService service) {
        this.service = service;
    }


    /**
     * 创建题目学习
     *
     * @param param
     * @return
     */
    @PostMapping("/createQuestionBankDetailsStudy")
    public ApiResult createQuestionBankDetailsStudy(@RequestBody @Valid CreateQuestionBankDetailsStudyParam param) {
        service.createQuestionBankDetailsStudy(param);
        return ApiResult.ok();
    }


    /**
     * 修改题目学习
     *
     * @param param
     */
    @PutMapping("/editQuestionBankDetailsStudy")
    public ApiResult editQuestionBankDetailsStudy(@RequestBody @Valid EditQuestionBankDetailsStudyParam param) {
        service.editQuestionBankDetailsStudy(param);
        return ApiResult.ok();
    }

    /**
     * 移除题目学习
     *
     * @param id
     */
    @DeleteMapping("/removeQuestionBankDetailsStudy")
    public ApiResult removeQuestionBankDetailsStudy(@RequestParam("id") Long id) {
        service.removeQuestionBankDetailsStudy(id);
        return ApiResult.ok();
    }

    /**
     * 启动/禁用题目学习
     *
     * @param id
     */
    @GetMapping("/enabledQuestionBankDetailsStudy")
    public ApiResult enabledQuestionBankDetailsStudy(@RequestParam("id") Long id) {
        service.enabledQuestionBankDetailsStudy(id);
        return ApiResult.ok();
    }

    /**
     * 获取题目学习详情
     *
     * @param id
     * @return
     */
    @GetMapping("/getQuestionBankDetailsStudy")
    public ApiResult<GetQuestionBankDetailsStudyVo> getQuestionBankDetailsStudy(@RequestParam("id") Long id) {
        GetQuestionBankDetailsStudyVo vo = service.getQuestionBankDetailsStudy(id);
        return ApiResult.ok(vo);
    }

    /**
     * 获取题目学习列表
     *
     * @param param
     * @return
     */
    @PostMapping("/getQuestionBankDetailsStudyList")
    public ApiResult<PageResult<GetQuestionBankDetailsStudyListVo>> getQuestionBankDetailsStudyList(@RequestBody GetQuestionBankDetailsStudyListParam param) {
        PageResult<GetQuestionBankDetailsStudyListVo> result = service.getQuestionBankDetailsStudyList(param);
        return ApiResult.ok(result);
    }


    /**
     * 获取题目学习下拉列表
     *
     * @return
     */
    @PostMapping("/getQuestionBankDetailsStudyDownList")
    public ApiResult<List<GetQuestionBankDetailsStudyDownListVo>> getQuestionBankDetailsStudyDownList(@RequestBody(required = false) @Valid GetQuestionBankDetailsStudyDownListParam param) {
        List<GetQuestionBankDetailsStudyDownListVo> list = service.getQuestionBankDetailsStudyDownList(param);
        return ApiResult.ok(list);
    }


}

